/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package presentation.view;

import javax.swing.ImageIcon;
import javax.swing.JMenuBar;
import javax.swing.JOptionPane;
import javax.swing.JPanel;

/**
 *
 * @author Joanna 8a
 */
public class MainFrame extends javax.swing.JFrame {

    /**
     * Creates new form MainFrame
     */
    public MainFrame() {
        initComponents();
        setTitle("Itineribus [v0.2]");
        controlBarraHerramientas(false, false);
        this.cambiarPanel(new PanelLogin(this));

    }

    public void controlBarraHerramientas(boolean habilitar, boolean admin) {
        if (admin) {
            jMenuBar1.removeAll();
            jMenuBar1.add(jMenuTeacher);
            jMenuBar1.add(jMenuSubjects);
            jMenuBar1.add(jMenuMyAccount);
        } else {
            jMenuBar1.removeAll();
            jMenuBar1.add(jMenuSchedule);
            jMenuBar1.add(jMenuNotes);
            jMenuBar1.add(jMenuContacts);
            jMenuBar1.add(jMenuMyAccount);
            jMenuBar1.add(jMenuAbout);
        }
        jMenuBar1.setVisible(habilitar);
        this.setResizable(habilitar);
    }

    public void cambiarPanel(JPanel panel) {


        jScrollPane1.getViewport().setVisible(false);
        jPanelMainPanel.setVisible(false);
        jScrollPane1.getViewport().removeAll();
        if (panel != null) {
            jScrollPane1.getViewport().add(panel);
            jPanelMainPanel.setSize(panel.getPreferredSize());
            jPanelMainPanel.setVisible(true);
            jScrollPane1.getViewport().setVisible(true);
        }
        this.setSize(this.getPreferredSize());
        this.setLocationRelativeTo(null);

    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jPanelMainPanel = new javax.swing.JPanel();
        jScrollPane1 = new javax.swing.JScrollPane();
        jMenuBar1 = new javax.swing.JMenuBar();
        jMenuSchedule = new javax.swing.JMenu();
        jMenuItemSeeSchedule = new javax.swing.JMenuItem();
        jMenuItemUpdateSchedule = new javax.swing.JMenuItem();
        jMenuItemDeleteSchedule = new javax.swing.JMenuItem();
        jMenuItemNewSchedule = new javax.swing.JMenuItem();
        jMenuNotes = new javax.swing.JMenu();
        jMenuItemSeeNotes = new javax.swing.JMenuItem();
        jMenuItemAddGrade = new javax.swing.JMenuItem();
        jMenuItemUpdateNotes = new javax.swing.JMenuItem();
        jMenuContacts = new javax.swing.JMenu();
        jMenuItemSeeContacts = new javax.swing.JMenuItem();
        jMenuItemUpdateContacts = new javax.swing.JMenuItem();
        jMenuItemDeleteContacts = new javax.swing.JMenuItem();
        jMenuItemAddContact = new javax.swing.JMenuItem();
        jMenuSubjects = new javax.swing.JMenu();
        jMenuItemAddSubject = new javax.swing.JMenuItem();
        jMenuItemUpdateSubject = new javax.swing.JMenuItem();
        jMenuItemDeleteSubject = new javax.swing.JMenuItem();
        jMenuTeacher = new javax.swing.JMenu();
        jMenuItemAddTeacher = new javax.swing.JMenuItem();
        jMenuItemUpdateTeacher = new javax.swing.JMenuItem();
        jMenuItemDeleteTeacher = new javax.swing.JMenuItem();
        jMenuMyAccount = new javax.swing.JMenu();
        jMenuItemSeeAccount = new javax.swing.JMenuItem();
        jMenuItemUpdateAccount = new javax.swing.JMenuItem();
        jMenuItemDeleteAccount = new javax.swing.JMenuItem();
        jMenuItemLogOut = new javax.swing.JMenuItem();
        jMenuItemExit = new javax.swing.JMenuItem();
        jMenuAbout = new javax.swing.JMenu();
        jMenuItemAbout = new javax.swing.JMenuItem();

        setDefaultCloseOperation(javax.swing.WindowConstants.DO_NOTHING_ON_CLOSE);
        setIconImage(new ImageIcon(getClass().getResource("/presentation/view/images/itineribusx64.png")).getImage());
        addWindowListener(new java.awt.event.WindowAdapter() {
            public void windowClosing(java.awt.event.WindowEvent evt) {
                formWindowClosing(evt);
            }
        });

        jPanelMainPanel.setLayout(new java.awt.BorderLayout());
        jPanelMainPanel.add(jScrollPane1, java.awt.BorderLayout.CENTER);

        getContentPane().add(jPanelMainPanel, java.awt.BorderLayout.CENTER);

        jMenuBar1.setFont(new java.awt.Font("Segoe UI Light", 1, 14)); // NOI18N

        jMenuSchedule.setIcon(new javax.swing.ImageIcon(getClass().getResource("/presentation/view/images/Calendar.png"))); // NOI18N
        jMenuSchedule.setText("Horario");
        jMenuSchedule.setFont(new java.awt.Font("Segoe UI Light", 1, 12)); // NOI18N

        jMenuItemSeeSchedule.setFont(new java.awt.Font("Segoe UI Light", 0, 12)); // NOI18N
        jMenuItemSeeSchedule.setIcon(new javax.swing.ImageIcon(getClass().getResource("/presentation/view/images/Document2.png"))); // NOI18N
        jMenuItemSeeSchedule.setText("Ver Horario");
        jMenuItemSeeSchedule.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItemSeeScheduleActionPerformed(evt);
            }
        });
        jMenuSchedule.add(jMenuItemSeeSchedule);

        jMenuItemUpdateSchedule.setFont(new java.awt.Font("Segoe UI Light", 0, 12)); // NOI18N
        jMenuItemUpdateSchedule.setIcon(new javax.swing.ImageIcon(getClass().getResource("/presentation/view/images/Write3.png"))); // NOI18N
        jMenuItemUpdateSchedule.setText("Modificar Horario");
        jMenuItemUpdateSchedule.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItemUpdateScheduleActionPerformed(evt);
            }
        });
        jMenuSchedule.add(jMenuItemUpdateSchedule);

        jMenuItemDeleteSchedule.setFont(new java.awt.Font("Segoe UI Light", 0, 12)); // NOI18N
        jMenuItemDeleteSchedule.setIcon(new javax.swing.ImageIcon(getClass().getResource("/presentation/view/images/Clipboard Cut.png"))); // NOI18N
        jMenuItemDeleteSchedule.setText("Eliminar Horario");
        jMenuItemDeleteSchedule.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItemDeleteScheduleActionPerformed(evt);
            }
        });
        jMenuSchedule.add(jMenuItemDeleteSchedule);

        jMenuItemNewSchedule.setFont(new java.awt.Font("Segoe UI Light", 0, 12)); // NOI18N
        jMenuItemNewSchedule.setIcon(new javax.swing.ImageIcon(getClass().getResource("/presentation/view/images/Contact.png"))); // NOI18N
        jMenuItemNewSchedule.setText("Crear Nuevo Horario");
        jMenuItemNewSchedule.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItemNewScheduleActionPerformed(evt);
            }
        });
        jMenuSchedule.add(jMenuItemNewSchedule);

        jMenuBar1.add(jMenuSchedule);

        jMenuNotes.setIcon(new javax.swing.ImageIcon(getClass().getResource("/presentation/view/images/Clipboard Paste.png"))); // NOI18N
        jMenuNotes.setText("Calificaciones");
        jMenuNotes.setFont(new java.awt.Font("Segoe UI Light", 1, 12)); // NOI18N

        jMenuItemSeeNotes.setFont(new java.awt.Font("Segoe UI Light", 0, 12)); // NOI18N
        jMenuItemSeeNotes.setIcon(new javax.swing.ImageIcon(getClass().getResource("/presentation/view/images/Clipboard Copy.png"))); // NOI18N
        jMenuItemSeeNotes.setText("Ver Calificaciones");
        jMenuItemSeeNotes.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItemSeeNotesActionPerformed(evt);
            }
        });
        jMenuNotes.add(jMenuItemSeeNotes);

        jMenuItemAddGrade.setFont(new java.awt.Font("Segoe UI Light", 0, 12)); // NOI18N
        jMenuItemAddGrade.setIcon(new javax.swing.ImageIcon(getClass().getResource("/presentation/view/images/Plus.png"))); // NOI18N
        jMenuItemAddGrade.setText("Añadir Calificación");
        jMenuItemAddGrade.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItemAddGradeActionPerformed(evt);
            }
        });
        jMenuNotes.add(jMenuItemAddGrade);

        jMenuItemUpdateNotes.setFont(new java.awt.Font("Segoe UI Light", 0, 12)); // NOI18N
        jMenuItemUpdateNotes.setIcon(new javax.swing.ImageIcon(getClass().getResource("/presentation/view/images/Write2.png"))); // NOI18N
        jMenuItemUpdateNotes.setText("Modificar Calificaciones");
        jMenuItemUpdateNotes.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItemUpdateNotesActionPerformed(evt);
            }
        });
        jMenuNotes.add(jMenuItemUpdateNotes);

        jMenuBar1.add(jMenuNotes);

        jMenuContacts.setIcon(new javax.swing.ImageIcon(getClass().getResource("/presentation/view/images/Globe.png"))); // NOI18N
        jMenuContacts.setText("Contactos");
        jMenuContacts.setFont(new java.awt.Font("Segoe UI Light", 1, 12)); // NOI18N

        jMenuItemSeeContacts.setFont(new java.awt.Font("Segoe UI Light", 0, 12)); // NOI18N
        jMenuItemSeeContacts.setIcon(new javax.swing.ImageIcon(getClass().getResource("/presentation/view/images/Contact.png"))); // NOI18N
        jMenuItemSeeContacts.setText("Ver Contactos");
        jMenuItemSeeContacts.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItemSeeContactsActionPerformed(evt);
            }
        });
        jMenuContacts.add(jMenuItemSeeContacts);

        jMenuItemUpdateContacts.setFont(new java.awt.Font("Segoe UI Light", 0, 12)); // NOI18N
        jMenuItemUpdateContacts.setIcon(new javax.swing.ImageIcon(getClass().getResource("/presentation/view/images/Write.png"))); // NOI18N
        jMenuItemUpdateContacts.setText("Modificar Contacto");
        jMenuItemUpdateContacts.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItemUpdateContactsActionPerformed(evt);
            }
        });
        jMenuContacts.add(jMenuItemUpdateContacts);

        jMenuItemDeleteContacts.setFont(new java.awt.Font("Segoe UI Light", 0, 12)); // NOI18N
        jMenuItemDeleteContacts.setIcon(new javax.swing.ImageIcon(getClass().getResource("/presentation/view/images/Clipboard Cut.png"))); // NOI18N
        jMenuItemDeleteContacts.setText("Eliminar Contacto");
        jMenuItemDeleteContacts.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItemDeleteContactsActionPerformed(evt);
            }
        });
        jMenuContacts.add(jMenuItemDeleteContacts);

        jMenuItemAddContact.setFont(new java.awt.Font("Segoe UI Light", 0, 12)); // NOI18N
        jMenuItemAddContact.setIcon(new javax.swing.ImageIcon(getClass().getResource("/presentation/view/images/Plus.png"))); // NOI18N
        jMenuItemAddContact.setText("Agregar Contacto");
        jMenuItemAddContact.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItemAddContactActionPerformed(evt);
            }
        });
        jMenuContacts.add(jMenuItemAddContact);

        jMenuBar1.add(jMenuContacts);

        jMenuSubjects.setIcon(new javax.swing.ImageIcon(getClass().getResource("/presentation/view/images/Sitemap.png"))); // NOI18N
        jMenuSubjects.setText("Materias");
        jMenuSubjects.setFont(new java.awt.Font("Segoe UI Light", 1, 12)); // NOI18N

        jMenuItemAddSubject.setFont(new java.awt.Font("Segoe UI Light", 0, 12)); // NOI18N
        jMenuItemAddSubject.setIcon(new javax.swing.ImageIcon(getClass().getResource("/presentation/view/images/Plus.png"))); // NOI18N
        jMenuItemAddSubject.setText("Agregar Materia");
        jMenuItemAddSubject.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItemAddSubjectActionPerformed(evt);
            }
        });
        jMenuSubjects.add(jMenuItemAddSubject);

        jMenuItemUpdateSubject.setFont(new java.awt.Font("Segoe UI Light", 0, 12)); // NOI18N
        jMenuItemUpdateSubject.setIcon(new javax.swing.ImageIcon(getClass().getResource("/presentation/view/images/Write2.png"))); // NOI18N
        jMenuItemUpdateSubject.setText("Modificar Materia");
        jMenuItemUpdateSubject.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItemUpdateSubjectActionPerformed(evt);
            }
        });
        jMenuSubjects.add(jMenuItemUpdateSubject);

        jMenuItemDeleteSubject.setFont(new java.awt.Font("Segoe UI Light", 0, 12)); // NOI18N
        jMenuItemDeleteSubject.setIcon(new javax.swing.ImageIcon(getClass().getResource("/presentation/view/images/Clipboard Cut.png"))); // NOI18N
        jMenuItemDeleteSubject.setText("Eliminar Materia");
        jMenuItemDeleteSubject.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItemDeleteSubjectActionPerformed(evt);
            }
        });
        jMenuSubjects.add(jMenuItemDeleteSubject);

        jMenuBar1.add(jMenuSubjects);

        jMenuTeacher.setIcon(new javax.swing.ImageIcon(getClass().getResource("/presentation/view/images/Card3.png"))); // NOI18N
        jMenuTeacher.setText("Profesores");
        jMenuTeacher.setFont(new java.awt.Font("Segoe UI Light", 1, 12)); // NOI18N

        jMenuItemAddTeacher.setFont(new java.awt.Font("Segoe UI Light", 0, 12)); // NOI18N
        jMenuItemAddTeacher.setIcon(new javax.swing.ImageIcon(getClass().getResource("/presentation/view/images/Plus.png"))); // NOI18N
        jMenuItemAddTeacher.setText("Añadir Profesor");
        jMenuItemAddTeacher.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItemAddTeacherActionPerformed(evt);
            }
        });
        jMenuTeacher.add(jMenuItemAddTeacher);

        jMenuItemUpdateTeacher.setFont(new java.awt.Font("Segoe UI Light", 0, 12)); // NOI18N
        jMenuItemUpdateTeacher.setIcon(new javax.swing.ImageIcon(getClass().getResource("/presentation/view/images/Write2.png"))); // NOI18N
        jMenuItemUpdateTeacher.setText("Modificar Profesor");
        jMenuItemUpdateTeacher.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItemUpdateTeacherActionPerformed(evt);
            }
        });
        jMenuTeacher.add(jMenuItemUpdateTeacher);

        jMenuItemDeleteTeacher.setFont(new java.awt.Font("Segoe UI Light", 0, 12)); // NOI18N
        jMenuItemDeleteTeacher.setIcon(new javax.swing.ImageIcon(getClass().getResource("/presentation/view/images/Clipboard Cut.png"))); // NOI18N
        jMenuItemDeleteTeacher.setText("Eliminar Profesor");
        jMenuItemDeleteTeacher.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItemDeleteTeacherActionPerformed(evt);
            }
        });
        jMenuTeacher.add(jMenuItemDeleteTeacher);

        jMenuBar1.add(jMenuTeacher);

        jMenuMyAccount.setIcon(new javax.swing.ImageIcon(getClass().getResource("/presentation/view/images/Smiley1.png"))); // NOI18N
        jMenuMyAccount.setText("Mi Cuenta");
        jMenuMyAccount.setFont(new java.awt.Font("Segoe UI Light", 1, 12)); // NOI18N

        jMenuItemSeeAccount.setFont(new java.awt.Font("Segoe UI Light", 0, 12)); // NOI18N
        jMenuItemSeeAccount.setIcon(new javax.swing.ImageIcon(getClass().getResource("/presentation/view/images/Contact.png"))); // NOI18N
        jMenuItemSeeAccount.setText("Ver Cuenta");
        jMenuItemSeeAccount.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItemSeeAccountActionPerformed(evt);
            }
        });
        jMenuMyAccount.add(jMenuItemSeeAccount);

        jMenuItemUpdateAccount.setFont(new java.awt.Font("Segoe UI Light", 0, 12)); // NOI18N
        jMenuItemUpdateAccount.setIcon(new javax.swing.ImageIcon(getClass().getResource("/presentation/view/images/Write.png"))); // NOI18N
        jMenuItemUpdateAccount.setText("Modificar Cuenta");
        jMenuItemUpdateAccount.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItemUpdateAccountActionPerformed(evt);
            }
        });
        jMenuMyAccount.add(jMenuItemUpdateAccount);

        jMenuItemDeleteAccount.setFont(new java.awt.Font("Segoe UI Light", 0, 12)); // NOI18N
        jMenuItemDeleteAccount.setIcon(new javax.swing.ImageIcon(getClass().getResource("/presentation/view/images/Clipboard Cut.png"))); // NOI18N
        jMenuItemDeleteAccount.setText("Eliminar Cuenta");
        jMenuItemDeleteAccount.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItemDeleteAccountActionPerformed(evt);
            }
        });
        jMenuMyAccount.add(jMenuItemDeleteAccount);

        jMenuItemLogOut.setFont(new java.awt.Font("Segoe UI Light", 0, 12)); // NOI18N
        jMenuItemLogOut.setIcon(new javax.swing.ImageIcon(getClass().getResource("/presentation/view/images/Go Out.png"))); // NOI18N
        jMenuItemLogOut.setText("Cerrar Sesión");
        jMenuItemLogOut.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItemLogOutActionPerformed(evt);
            }
        });
        jMenuMyAccount.add(jMenuItemLogOut);

        jMenuItemExit.setFont(new java.awt.Font("Segoe UI Light", 0, 12)); // NOI18N
        jMenuItemExit.setIcon(new javax.swing.ImageIcon(getClass().getResource("/presentation/view/images/Standby.png"))); // NOI18N
        jMenuItemExit.setText("Salir");
        jMenuItemExit.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItemExitActionPerformed(evt);
            }
        });
        jMenuMyAccount.add(jMenuItemExit);

        jMenuBar1.add(jMenuMyAccount);

        jMenuAbout.setIcon(new javax.swing.ImageIcon(getClass().getResource("/presentation/view/images/Info2.png"))); // NOI18N
        jMenuAbout.setText("Acerca de...");
        jMenuAbout.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuAboutActionPerformed(evt);
            }
        });

        jMenuItemAbout.setText("About");
        jMenuItemAbout.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItemAboutActionPerformed(evt);
            }
        });
        jMenuAbout.add(jMenuItemAbout);

        jMenuBar1.add(jMenuAbout);

        setJMenuBar(jMenuBar1);

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void jMenuItemSeeAccountActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItemSeeAccountActionPerformed
        String verCuenta = "Ver Cuenta";
        AuxiliarFrame aux = new AuxiliarFrame();
        aux.cambiarPanel(new PanelMyAccount(false, verCuenta, this, aux));
        aux.setVisible(true);
    }//GEN-LAST:event_jMenuItemSeeAccountActionPerformed

    private void jMenuItemSeeScheduleActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItemSeeScheduleActionPerformed
        AuxiliarFrame aux = new AuxiliarFrame();
        aux.cambiarPanel(new PanelCreateSchedule(aux, null, null, PanelCreateSchedule.VIEW_SHCEDULE));
        aux.setVisible(true);
    }//GEN-LAST:event_jMenuItemSeeScheduleActionPerformed

    private void jMenuItemUpdateContactsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItemUpdateContactsActionPerformed
        AuxiliarFrame aux = new AuxiliarFrame();
        aux.cambiarPanel(new PanelSeeContacts(2, aux));
        aux.setVisible(true);
    }//GEN-LAST:event_jMenuItemUpdateContactsActionPerformed

    private void jMenuItemAddSubjectActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItemAddSubjectActionPerformed
        AuxiliarFrame aux = new AuxiliarFrame();
        aux.cambiarPanel(new SubjectPanel(aux, SubjectPanel.ADD_SUBJECT));
        aux.setVisible(true);
    }//GEN-LAST:event_jMenuItemAddSubjectActionPerformed

    private void jMenuItemDeleteScheduleActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItemDeleteScheduleActionPerformed
        AuxiliarFrame aux = new AuxiliarFrame();
        aux.cambiarPanel(new PanelCreateSchedule(aux, null, null, PanelCreateSchedule.DELETE_SCHEDULE));
        aux.setVisible(true);
    }//GEN-LAST:event_jMenuItemDeleteScheduleActionPerformed

    private void jMenuItemUpdateAccountActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItemUpdateAccountActionPerformed
        AuxiliarFrame aux = new AuxiliarFrame();
        aux.cambiarPanel(new PanelRegister(this, "Modificar", aux));
        aux.setVisible(true);
    }//GEN-LAST:event_jMenuItemUpdateAccountActionPerformed

    private void jMenuItemDeleteAccountActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItemDeleteAccountActionPerformed
        String elimCuenta = "Eliminar Cuenta";
        AuxiliarFrame aux = new AuxiliarFrame();
        aux.cambiarPanel(new PanelMyAccount(false, elimCuenta, this, aux));
        aux.setVisible(true);
    }//GEN-LAST:event_jMenuItemDeleteAccountActionPerformed

    private void jMenuItemExitActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItemExitActionPerformed
        vo.StudentVO al = new presentation.controller.ControlPanelMyAccount().findByIp();
        al.setActiveUser(new presentation.controller.ControlPanelRegister().colocarIpUsuario());
        new presentation.controller.ControlPanelRegister().modificarAlumno(al, al.getPassword());
        System.exit(0);
    }//GEN-LAST:event_jMenuItemExitActionPerformed

    private void jMenuItemUpdateSubjectActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItemUpdateSubjectActionPerformed
        AuxiliarFrame aux = new AuxiliarFrame();
        aux.cambiarPanel(new SubjectPanel(aux, SubjectPanel.UPDATE_SUBJECT));
        aux.setVisible(true);
    }//GEN-LAST:event_jMenuItemUpdateSubjectActionPerformed

    private void jMenuItemDeleteSubjectActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItemDeleteSubjectActionPerformed
        AuxiliarFrame aux = new AuxiliarFrame();
        aux.cambiarPanel(new SubjectPanel(aux, SubjectPanel.DELETE_SUBJECT));
        aux.setVisible(true);
    }//GEN-LAST:event_jMenuItemDeleteSubjectActionPerformed

    private void jMenuItemSeeContactsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItemSeeContactsActionPerformed
        AuxiliarFrame aux = new AuxiliarFrame();
        aux.cambiarPanel(new PanelSeeContacts(1, aux));
        aux.setVisible(true);
    }//GEN-LAST:event_jMenuItemSeeContactsActionPerformed

    private void jMenuItemSeeNotesActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItemSeeNotesActionPerformed
        AuxiliarFrame aux = new AuxiliarFrame();
        aux.cambiarPanel(new PanelNotes(aux,true));
        aux.setVisible(true);
    }//GEN-LAST:event_jMenuItemSeeNotesActionPerformed

    private void jMenuItemUpdateNotesActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItemUpdateNotesActionPerformed
        AuxiliarFrame aux = new AuxiliarFrame();
        aux.cambiarPanel(new PanelNotes(aux,false));
        aux.setVisible(true);
    }//GEN-LAST:event_jMenuItemUpdateNotesActionPerformed

    private void jMenuItemDeleteContactsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItemDeleteContactsActionPerformed
        AuxiliarFrame aux = new AuxiliarFrame();
        aux.cambiarPanel(new PanelSeeContacts(3, aux));
        aux.setVisible(true);
    }//GEN-LAST:event_jMenuItemDeleteContactsActionPerformed

    private void jMenuItemAddTeacherActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItemAddTeacherActionPerformed
        AuxiliarFrame aux = new AuxiliarFrame();
        aux.cambiarPanel(new PanelAddTeacher(aux));
        aux.setVisible(true);
    }//GEN-LAST:event_jMenuItemAddTeacherActionPerformed

    private void jMenuItemUpdateTeacherActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItemUpdateTeacherActionPerformed
        AuxiliarFrame aux = new AuxiliarFrame();
        aux.cambiarPanel(new PanelUpdateTeacher(1, aux));
        aux.setVisible(true);
    }//GEN-LAST:event_jMenuItemUpdateTeacherActionPerformed

    private void jMenuItemDeleteTeacherActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItemDeleteTeacherActionPerformed
        AuxiliarFrame aux = new AuxiliarFrame();
        aux.cambiarPanel(new PanelUpdateTeacher(2, aux));
        aux.setVisible(true);
    }//GEN-LAST:event_jMenuItemDeleteTeacherActionPerformed

    private void jMenuItemUpdateScheduleActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItemUpdateScheduleActionPerformed
        AuxiliarFrame aux = new AuxiliarFrame();
        aux.cambiarPanel(new PanelSearchSubjects(aux, PanelSearchSubjects.UPDATE_SCHEDULE));
        aux.setVisible(true);
    }//GEN-LAST:event_jMenuItemUpdateScheduleActionPerformed

    private void jMenuItemLogOutActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItemLogOutActionPerformed
        vo.StudentVO al = new presentation.controller.ControlPanelMyAccount().findByIp();
        al.setActiveUser(new presentation.controller.ControlPanelRegister().colocarIpUsuario());
        new presentation.controller.ControlPanelRegister().modificarAlumno(al, al.getPassword());
        JOptionPane.showMessageDialog(this,
                "Sesión cerrada con éxito.");

        controlBarraHerramientas(false, false);

        cambiarPanel(new PanelLogin(this));

        //codigo para la sesion        
    }//GEN-LAST:event_jMenuItemLogOutActionPerformed

    private void jMenuItemAddContactActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItemAddContactActionPerformed
        AuxiliarFrame aux = new AuxiliarFrame();
        aux.cambiarPanel(new PanelAddContact(aux));
        aux.setVisible(true);
    }//GEN-LAST:event_jMenuItemAddContactActionPerformed

    private void jMenuItemNewScheduleActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItemNewScheduleActionPerformed
        AuxiliarFrame aux = new AuxiliarFrame();
        aux.cambiarPanel(new PanelSearchSubjects(aux, PanelSearchSubjects.CREATE_SCHEDULE));
        aux.setVisible(true);
    }//GEN-LAST:event_jMenuItemNewScheduleActionPerformed

    private void jMenuAboutActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuAboutActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_jMenuAboutActionPerformed

    private void jMenuItemAboutActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItemAboutActionPerformed
        // TODO add your handling code here:
        JOptionPane.showMessageDialog(this,
                "Itineribus[v.0.2] Algun día sera terminado.",
                "Acerca de...",
                JOptionPane.INFORMATION_MESSAGE, new javax.swing.ImageIcon(getClass().getResource("/presentation/view/images/itineribusx64.png")));
    }//GEN-LAST:event_jMenuItemAboutActionPerformed

    private void formWindowClosing(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_formWindowClosing
        vo.StudentVO al = new presentation.controller.ControlPanelMyAccount().findByIp();
        if (al != null) {
            al.setActiveUser(new presentation.controller.ControlPanelRegister().colocarIpUsuario());
            new presentation.controller.ControlPanelRegister().modificarAlumno(al, al.getPassword());
        }
        System.exit(0);
    }//GEN-LAST:event_formWindowClosing

    private void jMenuItemAddGradeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItemAddGradeActionPerformed
        // TODO add your handling code here:
         AuxiliarFrame aux = new AuxiliarFrame();
        aux.cambiarPanel(new PanelAddGrade(aux, -1, PanelAddGrade.ADD, null));
        aux.setVisible(true);
    }//GEN-LAST:event_jMenuItemAddGradeActionPerformed

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /*
         * Set the Nimbus look and feel
         */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /*
         * If Nimbus (introduced in Java SE 6) is not available, stay with the
         * default look and feel. For details see
         * http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(MainFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(MainFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(MainFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(MainFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>

        /*
         * Create and display the form
         */
        java.awt.EventQueue.invokeLater(new Runnable() {

            public void run() {
                MainFrame fp = new MainFrame();
                fp.setLocationRelativeTo(null);
                fp.setVisible(true);
            }
        });
    }

    public JMenuBar getjMenuBar1() {
        return jMenuBar1;
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JMenu jMenuAbout;
    private javax.swing.JMenuBar jMenuBar1;
    private javax.swing.JMenu jMenuContacts;
    private javax.swing.JMenuItem jMenuItemAbout;
    private javax.swing.JMenuItem jMenuItemAddContact;
    private javax.swing.JMenuItem jMenuItemAddGrade;
    private javax.swing.JMenuItem jMenuItemAddSubject;
    private javax.swing.JMenuItem jMenuItemAddTeacher;
    private javax.swing.JMenuItem jMenuItemDeleteAccount;
    private javax.swing.JMenuItem jMenuItemDeleteContacts;
    private javax.swing.JMenuItem jMenuItemDeleteSchedule;
    private javax.swing.JMenuItem jMenuItemDeleteSubject;
    private javax.swing.JMenuItem jMenuItemDeleteTeacher;
    private javax.swing.JMenuItem jMenuItemExit;
    private javax.swing.JMenuItem jMenuItemLogOut;
    private javax.swing.JMenuItem jMenuItemNewSchedule;
    private javax.swing.JMenuItem jMenuItemSeeAccount;
    private javax.swing.JMenuItem jMenuItemSeeContacts;
    private javax.swing.JMenuItem jMenuItemSeeNotes;
    private javax.swing.JMenuItem jMenuItemSeeSchedule;
    private javax.swing.JMenuItem jMenuItemUpdateAccount;
    private javax.swing.JMenuItem jMenuItemUpdateContacts;
    private javax.swing.JMenuItem jMenuItemUpdateNotes;
    private javax.swing.JMenuItem jMenuItemUpdateSchedule;
    private javax.swing.JMenuItem jMenuItemUpdateSubject;
    private javax.swing.JMenuItem jMenuItemUpdateTeacher;
    private javax.swing.JMenu jMenuMyAccount;
    private javax.swing.JMenu jMenuNotes;
    private javax.swing.JMenu jMenuSchedule;
    private javax.swing.JMenu jMenuSubjects;
    private javax.swing.JMenu jMenuTeacher;
    private javax.swing.JPanel jPanelMainPanel;
    private javax.swing.JScrollPane jScrollPane1;
    // End of variables declaration//GEN-END:variables
}
